<extend name="Base/common"/>
<block name="style">
    <link href="__CSS__/student.css" type="text/css" rel="stylesheet">
</block>
 <block name="header">
    <include file="Public/nav"/>
</block> 
<block name="body">

      <!--   <include file="Public/_hot_sell"/> -->
        <!-- 左侧菜start -->
        <div class="col-xs-2">
             <div class="common_block_border">                
                <div class="content ">
                <include file="Public/sidebar"  />
                </div>
            </div>
        </div>
        <!-- 左侧菜end -->

        <!-- 右侧内容开始 -->
        <div class="col-xs-10">
        <div class="common_block_border">

      <ul class="nav nav-tabs">
        <li class="active"><a href="{:U('Score/studentScore')}">学生成绩录入</a></li>
        <li><a href="{:U('Score/studentScoreHz')}">学生成绩汇总</a></li>
       
        <li><a href="{:U('Score/setting')}">课程设置</a></li>
      </ul>
	<!-- 标题栏 -->
    <div class="right_box">
   <h4 style="color:#5A81C8">&nbsp;&nbsp;<span class="icon icon-user"></span>&nbsp;&nbsp;学生成绩登记&nbsp;(考查科目)</h4>    
      
      <form method='post' id="form1" name="form1"  action="{:U('Score/studentScore')}" class="form-horizontal form-condensed">
                       <div class="form-group">
                       <div class="col-md-7">
                           <div class="input-group">
                              <span class="input-group-addon fix-padding">班级</span>                             
                                      <select name="bj_code" id="bj_code" class="form-control" onchange="this.form.submit()">
                                      <volist name="classlist" id="v">
                                      <option value="{$v.bj_code}" <if condition="$aarray['bj_code'] eq $v['bj_code']">selected</if> >{$v.bj_name}</option>
                                      </volist> 
                                      </select> 
                              <span class="input-group-addon fix-border">学科</span>                             
                                      <select name="subject" id="subject" class="form-control" onchange="this.form.submit()">
                                      <volist name="subjectlist" id="v">
                                      <option value="{$v.subject}" <if condition="$aarray['subject']  eq $v['subject']">selected</if> >{$v.subject}</option>
                                      </volist>            
                                      </select> 
                              <span class="input-group-addon fix-border fix-padding">学生姓名</span>
                               <input type="text" class="form-control" name="st_name" value="{$st_name}" placeholder="输入姓名查询">
                              <span class="input-group-btn">
                                <button class="btn btn-primary" type="submit">&nbsp;查询&nbsp;</button>
                              </span>
                            </div>
                        </div>
                        <div class="col-md-5">
                        <a class="btn btn-primary" href={:U('Student/Export/exportClassStudent',$aarray)}>&nbsp;导出学生记分表&nbsp;</a>
                        &nbsp;&nbsp;&nbsp;批量设置为：
                        <button type="button" id="A" class="btn btn-success" >&nbsp;A&nbsp;</button>
                        <button type="button" id="B" class="btn btn-info" >&nbsp;B&nbsp;</button>
                        <button type="button" id="C" class="btn btn-warning" >&nbsp;C&nbsp;</button>
                        <button type="button" id="D" class="btn btn-danger" >&nbsp;D&nbsp;</button>
                        </div>
                        <div class="col-md-2">
                        </div>
                       </div>
                  </form> 
      </div>  


    <!-- 数据列表 -->
     <div class="right_box">
     <!-- <php>dump($aarray)</php> -->
     <form method="post" action="{:U('savepostScore')}" name="studentScore" class="form-inline form-condensed">
        <div class="data-table">
         <table class="table table-bordered table-striped">
             <thead>
            <tr class="success text-center">            
                <th>序号</th>                
                <th>班级</th>                        
                <th>学号</th>
                <th class="text-center">姓名</th>                
                <th>性别</th>
                <th class="success text-center">{$aarray['subject']}成绩({$aarray['teacher']})</th>
                <th>修改日期</th>
                <th>录入人</th>                
                <th>操  作</th>
            </tr>
            </thead>
    
            <tbody>          
                <volist name="list" id="vo">
                <tr>                    
                    <td>{$i} </td>                    
                    <td><a title="{$vo.bj_code}">{:get_bjname($vo['bj_code'])}</a></td>
                    
                    <td>{$vo.st_code}</td>
                    <td>{$vo.st_name}</td>
                    <td>{$vo.sex}</td> 
                    <td style="width:120px;" class="text-center">
                    <select name="data[{$i}][score]" class="selector">
                    <option>{$vo.score}</option>
                    <option></option>
                    <option>A</option>
                    <option>B</option>
                    <option>C</option>
                    <option>D</option>        
                    </select>
                  
                    </td>       
                    <td><span><if condition="($vo.update_time eq 0)"> &nbsp <else/>
                    {$vo.update_time|date='Y-m-d H:i',###}</if></span>
                    </td>
                    <td>{$vo.user}
                    </td>                        
                    <td>
                    <if condition="($vo.sid eq 0)">
                    <a href="{:U('Score/edit','sid='.$vo['sid'])}" >编辑</a>|删除
                    <else/>
                        <a href="{:U('Score/edit','sid='.$vo['sid'])}" >编辑</a> |                        
                        <a href="{:U('Student/delete?id='.$vo['sid'])}" class="authorize">删除</a>
                    </if>                        
                    </td>
                        <input type="hidden" name="data[{$i}][sid]" value="{$vo.sid}" >
                        <input type="hidden" name="data[{$i}][sex]" value="{$vo.sex}" >
                        <input type="hidden" name="data[{$i}][term]" value="{:C('CUR_TERM')}" >
                        <input type="hidden" name="data[{$i}][oscore]" value="{$vo.score}" >
                        <input type="hidden" name="data[{$i}][bj_name]" value="{:get_bjname($vo['bj_code'])}" >
                        <input type="hidden" name="data[{$i}][bj_code]" value="{$vo.bj_code}" >
                        <input type="hidden" name="data[{$i}][st_code]" value="{$vo.st_code}" >
                        <input type="hidden" name="data[{$i}][st_name]" value="{$vo.st_name}" >
                        <input type="hidden" name="data[{$i}][subject]" value="{$aarray['subject']}" >
                </tr>
                </volist>
                
            </tbody>
            </table>  
        </div>

       <div class="right_box" style="height:50px;">
          <div class="col-md-2">
          <input type="hidden" name="subject" value="{$aarray['subject']}" >
          <input type="hidden" name="bj_code" value="{$aarray['bj_code']}" >
          <button type="submit" class="btn btn-success">保存成绩</button>
          <!-- <input type="submit" class="btn " value="保存成绩"> -->
          </div>
          <div class="col-md-10">考查科目学生成绩按A、B、C、D四档录入。</div>   
        </div>
        
        </form>
           
    </div>
    </div>
    <script>
	  $(function(){
	   $("button#A").click(function(){
	   	 // $(".selector").find("option:selected").attr("selected", false); 
	   	 // $(".selector option:contains('A')").attr("selected", true);
	 	  $(".selector").val("A");
	     alert('已成功将所有学生成绩设置为：A');  
	    });

	  $("#B").click(function(){
	  	$(".selector").val("B");
	    alert('已成功将所有学生成绩设置为：B');
	  
	  });

	  $("#C").click(function(){
	  	$(".selector").val("C");
	    alert('已成功将所有学生成绩设置为：C');
	  });

      $("#D").click(function(){
	  	$(".selector").val("D");
	    alert('已成功将所有学生成绩设置为：D');
	  });


	}); 

    </script>
   </block>

